webpackJsonp([64],{

/***/ "Bcv+":
/***/ (function(module, exports) {

// removed by extract-text-webpack-plugin

/***/ }),

/***/ "MyfE":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/regenerator/index.js
var regenerator = __webpack_require__("lC5x");
var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/core-js/promise.js
var promise = __webpack_require__("rVsN");
var promise_default = /*#__PURE__*/__webpack_require__.n(promise);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/helpers/slicedToArray.js
var slicedToArray = __webpack_require__("KH7x");
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/core-js/object/assign.js
var object_assign = __webpack_require__("aA9S");
var assign_default = /*#__PURE__*/__webpack_require__.n(object_assign);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/helpers/extends.js
var helpers_extends = __webpack_require__("4YfN");
var extends_default = /*#__PURE__*/__webpack_require__.n(helpers_extends);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/helpers/asyncToGenerator.js
var asyncToGenerator = __webpack_require__("J0Oq");
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);

// EXTERNAL MODULE: ./src/common/api/commonApi.js
var commonApi = __webpack_require__("+/+p");

// EXTERNAL MODULE: ./src/common/utils/index.js
var utils = __webpack_require__("dh3M");

// EXTERNAL MODULE: ./src/common/plugin/index.js + 207 modules
var common_plugin = __webpack_require__("Tvds");

// EXTERNAL MODULE: ./node_modules/_moment@2.24.0@moment/moment.js
var moment = __webpack_require__("ryJa");
var moment_default = /*#__PURE__*/__webpack_require__.n(moment);

// CONCATENATED MODULE: ./node_modules/_babel-loader@7.1.5@babel-loader/lib!./node_modules/_vue-loader@13.7.3@vue-loader/lib/selector.js?type=script&index=0!./src/apps/security-risk/list.vue






//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//





var TIME = [{ key: '近三天', endTime: moment_default()().subtract(3, 'days').format('YYYY-MM-DD') }, { key: '近一周', endTime: moment_default()().subtract(7, 'days').format('YYYY-MM-DD') }, { key: '近一个月', endTime: moment_default()().subtract(30, 'days').format('YYYY-MM-DD') }, { key: '近三个月', endTime: moment_default()().subtract(90, 'days').format('YYYY-MM-DD') }, { key: '近半年', endTime: moment_default()().subtract(180, 'days').format('YYYY-MM-DD') }, { key: '近一年', endTime: moment_default()().subtract(365, 'days').format('YYYY-MM-DD') }];
var LEVEL = [{ D_code: '1级', D_text: '一级风险' }, { D_code: '2级', D_text: '二级风险' }, { D_code: '3级', D_text: '三级风险' }, { D_code: '4级', D_text: '四级风险' }];
/* harmony default export */ var list = ({
  data: function data() {
    var _this = this;

    return {
      TIME: TIME,
      rightData: [{
        font: 'yt-icon yt-icon-search',
        click: function click() {
          _this.search = !_this.search;
        }
      }],
      search: false,
      condition: {
        time: '',
        type: [],
        genre: [],
        criteria: [],
        level: ''
      },
      disasterDic: [], // 事故类型
      riskTypeDic: [], // 因素类别
      levelDic: LEVEL, // 风险等级
      SecurityRiskControlCriteriaDic: [], // 评估标准
      searchApi: function () {
        var _ref = asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee(_ref2) {
          var skip = _ref2.skip,
              limit = _ref2.limit;

          var _condition, _condition$type, type, _condition$genre, genre, _condition$criteria, criteria, time, _condition$level, level, condition, timeQueryOption, param, p, _ref3, _ref4, disaster, riskType, data;

          return regenerator_default.a.wrap(function _callee$(_context) {
            while (1) {
              switch (_context.prev = _context.next) {
                case 0:
                  _this.condition.time = '';
                  _condition = _this.condition, _condition$type = _condition.type, type = _condition$type === undefined ? [] : _condition$type, _condition$genre = _condition.genre, genre = _condition$genre === undefined ? [] : _condition$genre, _condition$criteria = _condition.criteria, criteria = _condition$criteria === undefined ? [] : _condition$criteria, time = _condition.time, _condition$level = _condition.level, level = _condition$level === undefined ? [] : _condition$level;
                  // todo 数据库里的time为啥都是undefine，这样会导致查询出错

                  type = type.length ? { type: type } : {};
                  genre = genre.length ? { genre: genre } : {};
                  criteria = criteria.length ? { criteria: criteria } : {};
                  level = level.length ? { level: level } : {};

                  condition = extends_default()({}, type, criteria, genre, level);
                  timeQueryOption = time ? { greaterThanOrEqualTo: { time: time }, lessThanOrEqualTo: { time: moment_default()().format('YYYY-MM-DD') } } : {};
                  param = assign_default()(extends_default()({ equalTo: _this.$route.query, containedIn: condition }, timeQueryOption), { skip: skip, limit: limit, include: ['user'] });
                  p = [commonApi["a" /* commonApi */].dictionary('disaster'), commonApi["a" /* commonApi */].dictionary('risk_type'), commonApi["a" /* commonApi */].search('security_risk_corporate', param)];
                  _context.next = 12;
                  return promise_default.a.all(p);

                case 12:
                  _ref3 = _context.sent;
                  _ref4 = slicedToArray_default()(_ref3, 3);
                  disaster = _ref4[0];
                  riskType = _ref4[1];
                  data = _ref4[2];

                  _this.disasterDic = disaster;
                  _this.riskTypeDic = riskType;

                  return _context.abrupt('return', Object(utils["d" /* ReplaceDictionary */])(data, { type: disaster }));

                case 20:
                case 'end':
                  return _context.stop();
              }
            }
          }, _callee, _this);
        }));

        return function searchApi(_x) {
          return _ref.apply(this, arguments);
        };
      }()
    };
  },
  activated: function activated() {
    this.init();
  },

  methods: {
    init: function init() {
      var _this2 = this;

      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee2() {
        return regenerator_default.a.wrap(function _callee2$(_context2) {
          while (1) {
            switch (_context2.prev = _context2.next) {
              case 0:
                if (!_this2.SecurityRiskControlCriteriaDic.length) {
                  _context2.next = 2;
                  break;
                }

                return _context2.abrupt('return');

              case 2:
                _context2.next = 4;
                return commonApi["a" /* commonApi */].search('SecurityRiskControlCriteria', {
                  ascending: 'order', equalTo: { 'active': true }
                });

              case 4:
                _this2.SecurityRiskControlCriteriaDic = _context2.sent;

              case 5:
              case 'end':
                return _context2.stop();
            }
          }
        }, _callee2, _this2);
      }))();
    },
    onSearch: function onSearch() {
      this.search = false;
      this.$refs.group.startPull();
    },
    goDetailPage: function goDetailPage(item) {
      this.$router.$push({ path: '/security-risk/detail', query: { objectId: item.id, gridId: item.gridId ? item.gridId.id : '' } });
    },
    getValue: function getValue(obj) {
      if (!obj) return '';
      return obj[0].score + '/' + obj[1].score + '/' + obj[2].score;
    },
    getValue2: function getValue2(obj) {
      if (!obj) return '';
      return obj[0].score * obj[1].score * obj[2].score;
    },
    initCondition: function initCondition() {
      this.condition = {
        time: '',
        type: [],
        genre: [],
        criteria: []
      };
    }
  }
});
// CONCATENATED MODULE: ./node_modules/_vue-loader@13.7.3@vue-loader/lib/template-compiler?{"id":"data-v-0410180c","hasScoped":true,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/_vue-loader@13.7.3@vue-loader/lib/selector.js?type=template&index=0!./src/apps/security-risk/list.vue
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('yt-page',{attrs:{"title":"安全风险列表","rightData":_vm.rightData}},[_c('yt-group',{ref:"group",attrs:{"searchApi":_vm.searchApi,"group":false},scopedSlots:_vm._u([{key:"default",fn:function(scope){return _c('yt-card',{staticClass:"no-padding",attrs:{"btn":"查看更多详情"},on:{"btn-click":function($event){return _vm.goDetailPage(scope)}}},[_c('yt-cell',{attrs:{"border":"none","label":"工艺/单元","value":scope.name}}),_vm._v(" "),_c('yt-cell',{attrs:{"border":"none","label":"事故类型","value":scope.type}}),_vm._v(" "),_c('yt-cell',{attrs:{"border":"none","label":"L/E/C","value":_vm.getValue(scope.contents)}}),_vm._v(" "),_c('yt-cell',{attrs:{"border":"none","label":"D(L*E*C)","value":_vm.getValue2(scope.contents)}}),_vm._v(" "),_c('yt-cell',{attrs:{"border":"none","label":"风险等级","value":scope.level}}),_vm._v(" "),_c('yt-cell',{attrs:{"border":"none","label":"风险内容","value":scope.des}})],1)}}])}),_vm._v(" "),_c('yt-popup',{attrs:{"slot":"alert","pos":"right","mask":true},slot:"alert",model:{value:(_vm.search),callback:function ($$v) {_vm.search=$$v},expression:"search"}},[_c('yt-page',{staticClass:"page",attrs:{"flex":true,"leftData":[],"title":"筛选条件"}},[_c('yt-form',[_c('yt-inlineSelect',{attrs:{"title":"风险等级","list":_vm.levelDic,"x":3,"label":"D_text","val":"D_code","multiple":""},model:{value:(_vm.condition.level),callback:function ($$v) {_vm.$set(_vm.condition, "level", $$v)},expression:"condition.level"}}),_vm._v(" "),_c('yt-inlineSelect',{attrs:{"title":"事故类型","list":_vm.disasterDic,"x":3,"label":"D_text","val":"D_code","multiple":""},model:{value:(_vm.condition.type),callback:function ($$v) {_vm.$set(_vm.condition, "type", $$v)},expression:"condition.type"}}),_vm._v(" "),_c('yt-inlineSelect',{attrs:{"title":"因素类别","list":_vm.riskTypeDic,"x":3,"label":"D_text","val":"D_code","multiple":""},model:{value:(_vm.condition.genre),callback:function ($$v) {_vm.$set(_vm.condition, "genre", $$v)},expression:"condition.genre"}}),_vm._v(" "),_c('yt-btn-group',{attrs:{"slot":"btn","shadow":false},slot:"btn"},[_c('yt-btn',{attrs:{"theme":"white"},on:{"click":function($event){_vm.search = false}}},[_vm._v("关闭")]),_vm._v(" "),_c('yt-btn',{on:{"click":_vm.onSearch}},[_vm._v("确定")])],1)],1)],1)],1)],1)}
var staticRenderFns = []
var esExports = { render: render, staticRenderFns: staticRenderFns }
/* harmony default export */ var security_risk_list = (esExports);
// CONCATENATED MODULE: ./src/apps/security-risk/list.vue
function injectStyle (ssrContext) {
  __webpack_require__("Bcv+")
}
var normalizeComponent = __webpack_require__("C7Lr")
/* script */


/* template */

/* template functional */
var __vue_template_functional__ = false
/* styles */
var __vue_styles__ = injectStyle
/* scopeId */
var __vue_scopeId__ = "data-v-0410180c"
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
  list,
  security_risk_list,
  __vue_template_functional__,
  __vue_styles__,
  __vue_scopeId__,
  __vue_module_identifier__
)

/* harmony default export */ var apps_security_risk_list = __webpack_exports__["default"] = (Component.exports);


/***/ })

});